<template>
  <el-aside class="aside" width="200px">
    <el-menu
      default-active="2"
      class="el-menu-vertical-demo"
      background-color="#000000"
      active-text-color="#ffd04b"
      text-color="#FFFFFF"
    >
      <h1 style="text-align: center; color: #FFFFFF;">宿舍管理系统</h1>
      <el-menu-item index="1">
        <el-icon><icon-menu /></el-icon>
        <span @click="shouye">首页</span>
      </el-menu-item>
      <el-sub-menu index="2">
        <template #title>
          <el-icon><location /></el-icon>
          <span>学生管理</span>
        </template>
        <el-menu-item-group style="text-align: center;">
          <el-menu-item index="2-1" @click="studentliebiao1">学生列表</el-menu-item>
        </el-menu-item-group>
      </el-sub-menu>

      <!-- 新增宿舍管理选项 -->
      <el-sub-menu index="3">
        <template #title>
          <el-icon><location /></el-icon>
          <span>宿舍管理</span>
        </template>
        <el-menu-item-group style="text-align: center;">
          <el-menu-item index="3-1" @click="dormManagement">宿舍列表</el-menu-item>
        </el-menu-item-group>
      </el-sub-menu>

      <el-sub-menu index="6">
        <template #title>
          <el-icon><location /></el-icon>
          <span>账号管理</span>
        </template>
        <el-menu-item-group style="text-align: center;">
          <el-menu-item index="6-1" @click="Accountmanagement">管理员账号</el-menu-item>
        </el-menu-item-group>
      </el-sub-menu>
    </el-menu>
  </el-aside>
</template>

<script setup>
import { useRouter } from 'vue-router';

const router = useRouter();

const shouye = () => {
  router.push("/home/main");
};

const studentliebiao1 = () => {
  router.push("/home/studentliebiao");
};

const Accountmanagement = () => {
  router.push("/home/account");
};

// 新增宿舍管理事件处理函数
const dormManagement = () => {
  router.push("/home/dorms");
};
</script>

<style scoped>
.aside {
  height: 110vh;
  background-color: black;
}
</style>